<?php
include_once '../../include/dbconf.php';
function list_link(){
	global $db;
	$list=$db->get_results("select * from link;",true);
	return $list;
}
function  get_link_list_by_id($id){
	global $db;
	$list=$db->get_results("select * from link where id=$id",true);
	return $list;
}

/**
 *
 * Enter description here ...
 * @param   $id
 * @param   $parent_id
 * @param   $catlog_name
 */
function  link_update($id,$link_name,$linke_url,$link_method,$link_picture){
	global $db;
	$sql="update  link   set link_name='$link_name', link_url='$linke_url',link_picture='$link_picture' ,link_method='$link_method'  where id=$id";
	$list=$db->query($sql,true);
	return $list>0;
}
/**
 *
 * Enter description here ...
 * @param   $id
 * @param   $parent_id
 * @param   $catlog_name
 */
function  link_add( $link_name,$linke_url,$link_method,$link_picture){
	global $db;
	$sql="insert into  link(link_name,link_url,link_picture,link_method) values ('$link_name','$linke_url','$link_picture','$link_method') ";
	$list=$db->query($sql,true);
	return $list>0;
}

/**
 *delete catalog by id
 *
 * @param   $id
 */
function  link_delete($id){
	global $db;
	$list=$db->query("delete from link where id=$id",true);
	return $list>0;
}


?>